package edu.cmu.vlis.datamining.TopologicalFeatures;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.jgrapht.alg.NeighborIndex;

import edu.cmu.vlis.datamining.core.Edge;
import edu.cmu.vlis.datamining.core.Feature;
import edu.cmu.vlis.datamining.core.IFeatureCalculator;
import edu.cmu.vlis.datamining.core.Vertex;

public class CascadeSimilarity implements IFeatureCalculator {
	private Map<Vertex,Set<Integer>>cascadeFList;
	private int featueId;

	public CascadeSimilarity(Map<Vertex,Set<Integer>>cascadeFList) {
		this.cascadeFList = cascadeFList;
		this.featueId = 5;
	}

	public Feature compute(Vertex a, Vertex b) {
		float score = 0;
		Set<Integer> fList1 = cascadeFList.get(a);
		Set<Integer> fList2 = cascadeFList.get(b);
		if(fList1==null || fList2==null) {
			//System.out.println("Not here.. ");
			return new Feature(this.featueId,score);
		}
		fList1.retainAll(fList2);
		return new Feature(this.featueId,fList1.size());
	}

}
